"use client"

import { useState, useEffect } from "react"
import { useRouter } from "next/navigation"
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"
import { Button } from "@/components/ui/button"
import { Input } from "@/components/ui/input"
import { Badge } from "@/components/ui/badge"
import { Textarea } from "@/components/ui/textarea"
import {
  Users,
  MessageSquare,
  Calendar,
  Search,
  Bell,
  Settings,
  User,
  BarChart3,
  Calculator,
  FileText,
  Target,
  Award,
  DollarSign,
  Clock,
  Eye,
  Heart,
  ChevronRight,
  Sparkles,
  Zap,
  BookOpen,
  Briefcase,
  Plus,
  Check,
  X,
  Quote,
  UserPlus,
  Lightbulb,
  Network,
} from "lucide-react"

export default function HomePage() {
  const router = useRouter()
  const [searchQuery, setSearchQuery] = useState("")
  const [currentTime, setCurrentTime] = useState(new Date())
  const [newTask, setNewTask] = useState("")
  const [showAddTask, setShowAddTask] = useState(false)
  const [currentQuoteIndex, setCurrentQuoteIndex] = useState(0)
  const [currentUser, setCurrentUser] = useState<any>(null)
  const [isLoading, setIsLoading] = useState(true)

  // 动态名言数组
  const motivationalQuotes = [
    {
      text: "创业就是要做别人不敢做的事，走别人不敢走的路。",
      author: "马云"
    },
    {
      text: "成功的秘诀在于坚持自己的目标。",
      author: "本杰明·富兰克林"
    },
    {
      text: "机会是留给有准备的人的。",
      author: "路易·巴斯德"
    },
    {
      text: "不要害怕放弃好的，去追求更好的。",
      author: "约翰·洛克菲勒"
    },
    {
      text: "创新驱动发展，创业成就未来。",
      author: "李开复"
    },
    {
      text: "想要成功，你必须跳出舒适区。",
      author: "罗伯特·清崎"
    },
    {
      text: "失败只是暂时的，放弃才是永远的。",
      author: "理查德·布兰森"
    },
    {
      text: "每一个伟大的事业都始于一个梦想。",
      author: "华特·迪士尼"
    }
  ]

  useEffect(() => {
    const timer = setInterval(() => {
      setCurrentTime(new Date())
    }, 1000)
    return () => clearInterval(timer)
  }, [])

  // 每分钟更换名言
  useEffect(() => {
    const quoteTimer = setInterval(() => {
      setCurrentQuoteIndex((prev) => (prev + 1) % motivationalQuotes.length)
    }, 60000) // 60秒 = 1分钟
    
    return () => clearInterval(quoteTimer)
  }, [])

  // 检查用户登录状态
  useEffect(() => {
    const user = localStorage.getItem('currentUser')
    if (user) {
      setCurrentUser(JSON.parse(user))
    }
    setIsLoading(false)
  }, [])

  // 处理登出
  const handleLogout = () => {
    localStorage.removeItem('currentUser')
    setCurrentUser(null)
    router.push('/')
  }

  // 处理功能点击（需要登录验证）
  const handleFeatureClick = (path: string) => {
    if (!currentUser) {
      alert('请先登录后使用此功能')
      router.push('/login')
      return
    }
    router.push(path)
  }

  // 根据当前时间获取问候语
  const getGreeting = () => {
    const hour = currentTime.getHours()
    
    if (hour >= 6 && hour < 9) {
      return "早上好"
    } else if (hour >= 9 && hour < 12) {
      return "上午好"
    } else if (hour >= 12 && hour < 14) {
      return "中午好"
    } else if (hour >= 14 && hour < 18) {
      return "下午好"
    } else if (hour >= 18 && hour < 23) {
      return "晚上好"
    } else {
      return "深夜好"
    }
  }

  // 模拟数据
  const hotNews = [
    {
      id: "hot_001",
      type: "success_story",
      title: "90后小伙开奶茶店3年开了200家分店，年营收破亿的秘诀",
      summary: "从一家10平米小店到200家连锁，他是如何在竞争激烈的奶茶市场杀出重围的？",
      category: "startup",
      priority: "high",
      time: "2小时前",
      tags: ["创业故事", "连锁经营"],
      readTime: "8分钟",
      views: 15420,
      likes: 1205,
      comments: 89,
    },
    {
      id: "hot_002",
      type: "funding_news",
      title: "AI教育赛道再获资本青睐，3家公司单月融资超10亿",
      summary: "人工智能+教育成为投资新热点，个性化学习、智能辅导等细分领域受到关注",
      category: "funding",
      priority: "high",
      time: "4小时前",
      tags: ["AI教育", "投融资"],
      readTime: "10分钟",
      views: 8930,
      likes: 892,
      comments: 67,
    },
    {
      id: "hot_003",
      type: "policy_analysis",
      title: "2024年创业扶持政策解读：税收优惠力度加大",
      summary: "新政策为初创企业提供更多支持，包括税收减免、资金补贴等多项措施",
      category: "policy",
      priority: "medium",
      time: "6小时前",
      tags: ["政策解读", "税收优惠"],
      readTime: "6分钟",
      views: 6543,
      likes: 543,
      comments: 34,
    },
  ]

  const quickActions = [
    {
      title: "商业计划书生成器",
      description: "AI辅助生成专业商业计划书",
      icon: FileText,
      color: "bg-slate-600",
      path: "/business-plan-generator",
    },
    {
      title: "市场分析工具",
      description: "深度分析目标市场和竞争环境",
      icon: BarChart3,
      color: "bg-slate-700",
      path: "/market-analyzer",
    },
    {
      title: "财务计算器",
      description: "计算ROI、盈亏平衡点等关键指标",
      icon: Calculator,
      color: "bg-amber-600",
      path: "/financial-calculator",
    },
    {
      title: "专家咨询",
      description: "预约行业专家一对一指导",
      icon: Users,
      color: "bg-emerald-600",
      path: "/expert-consultation",
    },
    {
      title: "公司定位分析",
      description: "帮助确定公司定位和差异化策略",
      icon: Target,
      color: "bg-slate-600",
      path: "/company-positioning",
    },
    {
      title: "产品分析工具",
      description: "深度分析产品特点和市场机会",
      icon: Award,
      color: "bg-amber-600",
      path: "/product-analysis",
    },
    {
      title: "网站模板建站",
      description: "快速创建专业的公司官网",
      icon: Network,
      color: "bg-slate-700",
      path: "/website-builder",
    },
    {
      title: "行业产品解析",
      description: "分析行业内竞品和市场趋势",
      icon: Lightbulb,
      color: "bg-emerald-600",
      path: "/industry-analysis",
    },
    {
      title: "商业知识库",
      description: "建立系统化的商业知识体系",
      icon: BookOpen,
      color: "bg-amber-600",
      path: "/knowledge-base",
    },
  ]

  // 找资源入口
  const findResources = [
    {
      title: "找团队",
      description: "寻找志同道合的创业伙伴",
      icon: UserPlus,
      color: "bg-slate-600",
      path: "/find-team",
      stats: "1,234+ 活跃成员",
    },
    {
      title: "找项目",
      description: "发现优质创业项目机会",
      icon: Lightbulb,
      color: "bg-amber-600",
      path: "/find-project",
      stats: "567+ 项目发布",
    },
    {
      title: "找渠道",
      description: "对接销售渠道和合作伙伴",
      icon: Network,
      color: "bg-emerald-600",
      path: "/find-channel",
      stats: "890+ 渠道资源",
    },
  ]

  const [todayTasks, setTodayTasks] = useState([
    { id: 1, task: "完善商业计划书第三章", priority: "high", completed: false },
    { id: 2, task: "联系潜在投资人", priority: "high", completed: false },
    { id: 3, task: "市场调研问卷设计", priority: "medium", completed: true },
    { id: 4, task: "团队周会准备", priority: "low", completed: false },
  ])

  const upcomingEvents = [
    {
      id: 1,
      title: "创业者线下聚会",
      date: "今天 19:00",
      location: "上海市浦东新区",
      attendees: 45,
    },
    {
      id: 2,
      title: "AI创业专题分享",
      date: "明天 14:00",
      location: "线上直播",
      attendees: 234,
    },
    {
      id: 3,
      title: "投资人见面会",
      date: "1月20日 15:00",
      location: "北京市朝阳区",
      attendees: 28,
    },
  ]

  const learningResources = [
    {
      id: 1,
      title: "创业基础课程",
      description: "从0到1的创业指南",
      color: "bg-slate-50",
      textColor: "text-slate-900",
      descColor: "text-slate-700",
      url: "/courses/startup-basics",
    },
    {
      id: 2,
      title: "融资实战技巧",
      description: "如何获得投资人青睐",
      color: "bg-amber-50",
      textColor: "text-amber-900",
      descColor: "text-amber-700",
      url: "/courses/funding-skills",
    },
    {
      id: 3,
      title: "团队管理艺术",
      description: "打造高效创业团队",
      color: "bg-emerald-50",
      textColor: "text-emerald-900",
      descColor: "text-emerald-700",
      url: "/courses/team-management",
    },
  ]

  const handleNewsClick = (newsId: string) => {
    router.push(`/news/${newsId}`)
  }

  const handleQuickAction = (path: string) => {
    handleFeatureClick(path)
  }

  const handleFindResourceClick = (path: string) => {
    handleFeatureClick(path)
  }

  const handleTaskToggle = (taskId: number) => {
    setTodayTasks((prev) => prev.map((task) => (task.id === taskId ? { ...task, completed: !task.completed } : task)))
  }

  const handleAddTask = () => {
    if (newTask.trim()) {
      const newTaskItem = {
        id: Date.now(),
        task: newTask.trim(),
        priority: "medium" as const,
        completed: false,
      }
      setTodayTasks((prev) => [...prev, newTaskItem])
      setNewTask("")
      setShowAddTask(false)
    }
  }

  const handleDeleteTask = (taskId: number) => {
    setTodayTasks((prev) => prev.filter((task) => task.id !== taskId))
  }

  const handleLearningClick = (url: string) => {
    router.push(url)
  }

  const getPriorityColor = (priority: string) => {
    switch (priority) {
      case "high":
        return "text-red-600 bg-red-100"
      case "medium":
        return "text-yellow-600 bg-yellow-100"
      case "low":
        return "text-green-600 bg-green-100"
      default:
        return "text-slate-600 bg-slate-100"
    }
  }

  return (
    <div className="min-h-screen bg-gradient-to-br from-gray-50 via-amber-50/20 to-slate-100/30">
      {/* 顶部导航栏 */}
      <header className="bg-white/80 backdrop-blur-xl border-b border-slate-200/50 sticky top-0 z-50">
        <div className="max-w-7xl mx-auto px-6 py-4">
          <div className="flex items-center justify-between">
            <div className="flex items-center space-x-4">
              <div className="flex items-center space-x-2">
                <div className="w-8 h-8 bg-gradient-to-br from-slate-700 to-slate-900 rounded-lg flex items-center justify-center">
                  <Briefcase className="w-5 h-5 text-amber-400" />
                </div>
                <h1 className="text-xl font-bold bg-gradient-to-r from-slate-700 to-slate-900 bg-clip-text text-transparent">
                  创业者之家
                </h1>
              </div>
              <Badge className="bg-emerald-100 text-emerald-700">
                <Zap className="w-3 h-3 mr-1" />
                在线
              </Badge>
            </div>

            <div className="flex-1 max-w-md mx-8">
              <div className="relative">
                <Search className="w-4 h-4 absolute left-3 top-1/2 transform -translate-y-1/2 text-slate-400" />
                <Input
                  placeholder="搜索资讯、工具、专家..."
                  className="pl-10 bg-white/70"
                  value={searchQuery}
                  onChange={(e) => setSearchQuery(e.target.value)}
                />
              </div>
            </div>

            <div className="flex items-center space-x-3">
              {currentUser ? (
                <>
                  <Button variant="ghost" size="sm" onClick={() => handleFeatureClick("/notifications")}>
                    <Bell className="w-4 h-4" />
                  </Button>
                  <Button variant="ghost" size="sm" onClick={() => handleFeatureClick("/settings")}>
                    <Settings className="w-4 h-4" />
                  </Button>
                  <div className="flex items-center space-x-2 px-3 py-1 bg-slate-100 rounded-full">
                    <User className="w-4 h-4 text-slate-600" />
                    <span className="text-sm text-slate-700">{currentUser.name}</span>
                  </div>
                  <Button variant="outline" size="sm" onClick={handleLogout}>
                    登出
                  </Button>
                </>
              ) : (
                <>
                  <Button variant="outline" size="sm" onClick={() => router.push("/login")}>
                    登录
                  </Button>
                  <Button size="sm" className="bg-slate-700 hover:bg-slate-800" onClick={() => router.push("/login")}>
                    注册
                  </Button>
                </>
              )}
            </div>
          </div>
        </div>
      </header>

      <main className="max-w-7xl mx-auto px-6 py-8">
        <div className="grid grid-cols-1 lg:grid-cols-4 gap-8">
          {/* 左侧主要内容 */}
          <div className="lg:col-span-3 space-y-8">
            {/* 每日一句 - 移到顶部 */}
            <Card className="bg-gradient-to-br from-amber-50 to-orange-50 border-amber-200">
              <CardContent className="p-6 text-center">
                <Quote className="w-8 h-8 text-amber-600 mx-auto mb-3" />
                <blockquote className="text-slate-700 italic mb-2 text-lg transition-all duration-500">
                  "{motivationalQuotes[currentQuoteIndex].text}"
                </blockquote>
                <cite className="text-sm text-slate-500 transition-all duration-500">
                  — {motivationalQuotes[currentQuoteIndex].author}
                </cite>
              </CardContent>
            </Card>

            {/* 欢迎区域 */}
            <div className="bg-gradient-to-r from-slate-800 to-slate-700 rounded-2xl p-8 text-white relative overflow-hidden">
              <div className="absolute top-0 right-0 w-64 h-64 bg-gradient-to-bl from-amber-400/20 to-transparent rounded-full -mr-32 -mt-32"></div>
              <div className="relative z-10">
                <div className="flex items-center justify-between">
                  <div>
                    <h2 className="text-2xl font-bold mb-2">
                      {currentUser ? `${getGreeting()}，${currentUser.name}！ 👋` : "欢迎来到创业者之家！ 👋"}
                    </h2>
                    <p className="text-amber-100 mb-4">
                      今天是{" "}
                      {currentTime.toLocaleDateString("zh-CN", {
                        year: "numeric",
                        month: "long",
                        day: "numeric",
                        weekday: "long",
                      })}
                    </p>
                    <p className="text-slate-200">
                      {currentUser 
                        ? "让我们一起把想法变成现实，开启新的创业征程！" 
                        : "登录后即可使用所有创业工具和功能"}
                    </p>
                  </div>
                  <div className="hidden md:block">
                    <div className="w-32 h-32 bg-amber-400/20 rounded-full flex items-center justify-center">
                      <Briefcase className="w-16 h-16 text-amber-300" />
                    </div>
                  </div>
                </div>
              </div>
            </div>

            {/* 未登录提示 */}
            {!currentUser && (
              <Card className="bg-gradient-to-r from-amber-50 to-orange-50 border-amber-200">
                <CardContent className="p-8 text-center">
                  <Briefcase className="w-16 h-16 text-amber-600 mx-auto mb-4" />
                  <h3 className="text-xl font-bold text-slate-900 mb-4">解锁更多功能</h3>
                  <p className="text-slate-600 mb-6">
                    注册登录后，您可以使用所有创业工具、保存项目数据、参与社区交流等
                  </p>
                  <div className="flex gap-4 justify-center">
                    <Button onClick={() => router.push("/login")} className="bg-slate-700 hover:bg-slate-800">
                      立即登录
                    </Button>
                    <Button variant="outline" onClick={() => router.push("/login")}>
                      免费注册
                    </Button>
                  </div>
                </CardContent>
              </Card>
            )}

            {/* 找资源入口 - 仅登录用户 */}
            {currentUser && (
              <div>
                <h3 className="text-xl font-semibold text-slate-900 mb-6">🔍 找资源</h3>
                <div className="grid grid-cols-1 md:grid-cols-3 gap-4">
                  {findResources.map((resource, index) => {
                    const Icon = resource.icon
                    return (
                      <Card
                        key={index}
                        className="cursor-pointer hover:shadow-lg transition-all duration-200 hover:-translate-y-1 bg-white/70 backdrop-blur-sm border-0"
                        onClick={() => handleFindResourceClick(resource.path)}
                      >
                        <CardContent className="p-6 text-center">
                          <div
                            className={`w-16 h-16 ${resource.color} rounded-full flex items-center justify-center mx-auto mb-4 shadow-lg`}
                          >
                            <Icon className="w-8 h-8 text-white" />
                          </div>
                          <h4 className="font-semibold text-slate-900 mb-2">{resource.title}</h4>
                          <p className="text-sm text-slate-600 mb-3">{resource.description}</p>
                          <Badge variant="outline" className="text-xs bg-slate-50">
                            {resource.stats}
                          </Badge>
                        </CardContent>
                      </Card>
                    )
                  })}
                </div>
              </div>
            )}

            {/* 快速操作 - 仅登录用户 */}
            {currentUser && (
              <div>
                <h3 className="text-xl font-semibold text-slate-900 mb-6">⚡ 快速开始</h3>
                <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
                  {quickActions.map((action, index) => {
                    const Icon = action.icon
                    return (
                      <Card
                        key={index}
                        className="cursor-pointer hover:shadow-lg transition-all duration-200 hover:-translate-y-1 bg-white/70 backdrop-blur-sm border-0"
                        onClick={() => handleQuickAction(action.path)}
                      >
                        <CardContent className="p-6">
                          <div className="flex items-center space-x-4">
                            <div className={`p-3 ${action.color} rounded-lg shadow-md`}>
                              <Icon className="w-6 h-6 text-white" />
                            </div>
                            <div className="flex-1">
                              <h4 className="font-semibold text-slate-900 mb-1">{action.title}</h4>
                              <p className="text-sm text-slate-600">{action.description}</p>
                            </div>
                            <ChevronRight className="w-5 h-5 text-slate-400" />
                          </div>
                        </CardContent>
                      </Card>
                    )
                  })}
                </div>
              </div>
            )}

            {/* 热门资讯 */}
            <div>
              <div className="flex items-center justify-between mb-6">
                <h3 className="text-xl font-semibold text-slate-900">📰 热门资讯</h3>
                <Button variant="outline" size="sm" onClick={() => router.push('/news')}>
                  查看更多
                </Button>
              </div>
              <div className="space-y-4">
                {hotNews.map((news) => (
                  <Card
                    key={news.id}
                    className="cursor-pointer hover:shadow-md transition-shadow bg-white/70 backdrop-blur-sm border-0"
                    onClick={() => handleNewsClick(news.id)}
                  >
                    <CardContent className="p-6">
                      <div className="flex items-start space-x-4">
                        <div className="flex-1">
                          <div className="flex items-center space-x-2 mb-2">
                            {news.type === "success_story" && (
                              <Badge className="bg-emerald-100 text-emerald-700">
                                <Award className="w-3 h-3 mr-1" />
                                成功案例
                              </Badge>
                            )}
                            {news.type === "funding_news" && (
                              <Badge className="bg-amber-100 text-amber-700">
                                <DollarSign className="w-3 h-3 mr-1" />
                                投融资
                              </Badge>
                            )}
                            {news.type === "policy_analysis" && (
                              <Badge className="bg-slate-100 text-slate-700">
                                <FileText className="w-3 h-3 mr-1" />
                                政策解读
                              </Badge>
                            )}
                            <Badge variant="outline">{news.readTime}</Badge>
                          </div>
                          <h4 className="font-semibold text-slate-900 mb-2 line-clamp-2">{news.title}</h4>
                          <p className="text-slate-600 text-sm mb-3 line-clamp-2">{news.summary}</p>
                          <div className="flex items-center justify-between">
                            <div className="flex items-center space-x-4 text-sm text-slate-500">
                              <div className="flex items-center space-x-1">
                                <Clock className="w-3 h-3" />
                                <span>{news.time}</span>
                              </div>
                              <div className="flex items-center space-x-1">
                                <Eye className="w-3 h-3" />
                                <span>{news.views}</span>
                              </div>
                              <div className="flex items-center space-x-1">
                                <Heart className="w-3 h-3" />
                                <span>{news.likes}</span>
                              </div>
                              <div className="flex items-center space-x-1">
                                <MessageSquare className="w-3 h-3" />
                                <span>{news.comments}</span>
                              </div>
                            </div>
                            <div className="flex flex-wrap gap-1">
                              {news.tags.slice(0, 2).map((tag, index) => (
                                <Badge key={index} variant="outline" className="text-xs">
                                  {tag}
                                </Badge>
                              ))}
                            </div>
                          </div>
                        </div>
                      </div>
                    </CardContent>
                  </Card>
                ))}
              </div>
            </div>
          </div>

          {/* 右侧边栏 */}
          <div className="space-y-6">
            {currentUser ? (
              <>
                {/* 今日任务 - 仅登录用户 */}
                <Card className="bg-white/70 backdrop-blur-sm border-0">
                  <CardHeader>
                    <CardTitle className="flex items-center justify-between">
                      <div className="flex items-center space-x-2">
                        <Target className="w-5 h-5" />
                        <span>今日任务</span>
                      </div>
                      <Button variant="ghost" size="sm" onClick={() => setShowAddTask(!showAddTask)}>
                        <Plus className="w-4 h-4" />
                      </Button>
                    </CardTitle>
                  </CardHeader>
                  <CardContent>
                    {showAddTask && (
                      <div className="mb-4 p-3 bg-slate-50 rounded-lg">
                        <Textarea
                          placeholder="输入新任务..."
                          value={newTask}
                          onChange={(e) => setNewTask(e.target.value)}
                          className="mb-2"
                          rows={2}
                        />
                        <div className="flex justify-end space-x-2">
                          <Button
                            variant="outline"
                            size="sm"
                            onClick={() => {
                              setShowAddTask(false)
                              setNewTask("")
                            }}
                          >
                            <X className="w-3 h-3 mr-1" />
                            取消
                          </Button>
                          <Button size="sm" onClick={handleAddTask} disabled={!newTask.trim()}>
                            <Check className="w-3 h-3 mr-1" />
                            添加
                          </Button>
                        </div>
                      </div>
                    )}

                    <div className="space-y-3">
                      {todayTasks.map((task) => (
                        <div key={task.id} className="flex items-center space-x-3 group">
                          <input
                            type="checkbox"
                            checked={task.completed}
                            onChange={() => handleTaskToggle(task.id)}
                            className="rounded"
                          />
                          <div className="flex-1">
                            <p className={`text-sm ${task.completed ? "line-through text-slate-500" : "text-slate-700"}`}>
                              {task.task}
                            </p>
                            <Badge className={`${getPriorityColor(task.priority)} text-xs`}>
                              {task.priority === "high" ? "高" : task.priority === "medium" ? "中" : "低"}
                            </Badge>
                          </div>
                          <Button
                            variant="ghost"
                            size="sm"
                            onClick={() => handleDeleteTask(task.id)}
                            className="opacity-0 group-hover:opacity-100 transition-opacity text-red-600 hover:text-red-700"
                          >
                            <X className="w-3 h-3" />
                          </Button>
                        </div>
                      ))}
                    </div>
                  </CardContent>
                </Card>

                {/* 即将到来的活动 - 仅登录用户 */}
                <Card className="bg-white/70 backdrop-blur-sm border-0">
                  <CardHeader>
                    <CardTitle className="flex items-center space-x-2">
                      <Calendar className="w-5 h-5" />
                      <span>即将到来</span>
                    </CardTitle>
                  </CardHeader>
                  <CardContent>
                    <div className="space-y-4">
                      {upcomingEvents.map((event) => (
                        <div
                          key={event.id}
                          className="p-3 bg-slate-50 rounded-lg cursor-pointer hover:bg-slate-100 transition-colors"
                        >
                          <h4 className="font-medium text-slate-900 mb-1">{event.title}</h4>
                          <div className="text-sm text-slate-600 space-y-1">
                            <div className="flex items-center space-x-1">
                              <Clock className="w-3 h-3" />
                              <span>{event.date}</span>
                            </div>
                            <div className="flex items-center space-x-1">
                              <Users className="w-3 h-3" />
                              <span>{event.attendees} 人参加</span>
                            </div>
                          </div>
                        </div>
                      ))}
                    </div>
                    <Button size="sm" className="w-full mt-4" onClick={() => handleFeatureClick("/community")}>
                      <Calendar className="w-4 h-4 mr-2" />
                      查看更多活动
                    </Button>
                  </CardContent>
                </Card>
              </>
            ) : (
              /* 未登录用户侧边栏 */
              <Card className="bg-white/70 backdrop-blur-sm border-0">
                <CardHeader>
                  <CardTitle className="flex items-center space-x-2">
                    <User className="w-5 h-5" />
                    <span>登录获取更多</span>
                  </CardTitle>
                </CardHeader>
                <CardContent>
                  <div className="space-y-4 text-center">
                    <div className="p-4 bg-amber-50 rounded-lg">
                      <Target className="w-8 h-8 text-amber-600 mx-auto mb-2" />
                      <h4 className="font-medium text-slate-900 mb-1">任务管理</h4>
                      <p className="text-xs text-slate-600">创建和管理您的创业任务</p>
                    </div>
                    <div className="p-4 bg-emerald-50 rounded-lg">
                      <Calendar className="w-8 h-8 text-emerald-600 mx-auto mb-2" />
                      <h4 className="font-medium text-slate-900 mb-1">活动参与</h4>
                      <p className="text-xs text-slate-600">参加创业者线下聚会</p>
                    </div>
                    <div className="p-4 bg-slate-50 rounded-lg">
                      <BookOpen className="w-8 h-8 text-slate-600 mx-auto mb-2" />
                      <h4 className="font-medium text-slate-900 mb-1">个性化推荐</h4>
                      <p className="text-xs text-slate-600">获取定制化学习资源</p>
                    </div>
                    <Button onClick={() => router.push("/login")} className="w-full bg-slate-700 hover:bg-slate-800">
                      立即登录解锁
                    </Button>
                  </div>
                </CardContent>
              </Card>
            )}

            {/* 学习资源 - 所有用户可见 */}
            <Card className="bg-white/70 backdrop-blur-sm border-0">
              <CardHeader>
                <CardTitle className="flex items-center space-x-2">
                  <BookOpen className="w-5 h-5" />
                  <span>推荐学习</span>
                </CardTitle>
              </CardHeader>
              <CardContent>
                <div className="space-y-3">
                  {learningResources.map((resource) => (
                    <div
                      key={resource.id}
                      className={`p-3 ${resource.color} rounded-lg cursor-pointer hover:opacity-80 transition-opacity`}
                      onClick={() => handleLearningClick(resource.url)}
                    >
                      <h4 className={`font-medium ${resource.textColor} mb-1`}>{resource.title}</h4>
                      <p className={`text-sm ${resource.descColor}`}>{resource.description}</p>
                    </div>
                  ))}
                </div>
              </CardContent>
            </Card>
          </div>
        </div>
      </main>
    </div>
  )
}
